// TypeScript file
declare let translatePx;
declare let translatePxS;

class LevelConfig extends egret.Sprite {
	// 场景控制器的单例
	private static instance: LevelConfig;
	// 游戏场景
	private gameScene: GameScene;

    private unitSize: number =  1.7;

    private LEVEL_CONFIG = [
        {   
            level: 1,
            type: 'math',
            title: '请根据语音提示点击气球的数量',
            gameOver:false,
            duration: 6000,
            targetList: [{
                imageUrl: 'balloon_png',
                y: this.translatePx(245.6),
                x: this.translatePx(76),
                width:this.translatePx(58),
                height: this.translatePx(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: this.translatePx(370),
                x: this.translatePx(40),
                width:this.translatePx(58),
                height: this.translatePx(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: this.translatePx(170),
                x: this.translatePx(160),
                width:this.translatePx(58),
                height: this.translatePx(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: this.translatePx(310),
                x: this.translatePx(185),
                width:this.translatePx(58),
                height: this.translatePx(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: this.translatePx(420),
                x: this.translatePx(250),
                width:this.translatePx(58),
                height: this.translatePx(79),
                afterClick: 'balloon_boom_png'
            }],
            initLevel($this) {
                $this.CURRENT_TARGET_NUM = 0;
                $this.TARGET_NUM = 5;
                $this.SCORE_BOARD.text = `${$this.CURRENT_TARGET_NUM}/${$this.TARGET_NUM}`
            },
            registerEvent(item,$this) {
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    $this.BOOM_SOUND.play(0,1);
                    item.texture = RES.getRes(`balloon_boom_png`);
                    $this.CURRENT_TARGET_NUM ++;
                    $this.SCORE_BOARD.text = `${$this.CURRENT_TARGET_NUM}/${$this.TARGET_NUM}`;
                    item.touchEnabled = false;
                    if($this.CURRENT_TARGET_NUM === $this.TARGET_NUM) {
                        setTimeout(() => {
                            $this.SUCCESS_MUSIC.play(0,1)
                        },500)
                        this.gameOver = true;
                        $this.showSuccessPage(this.type);
                    }
                }, $this);
            }
        },
        {   
            level: 2,
            type: 'math',
            title: '请听语音点击正确的气球数量',
            gameOver:false,
            duration: 6000,
            targetList: [{
                imageUrl: 'balloon_png',
                y: translatePxS(160),
                x: translatePxS(110),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(160),
                x: translatePxS(210),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(250),
                x: translatePxS(110),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(250),
                x: translatePxS(210),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(340),
                x: translatePxS(210),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(340),
                x: translatePxS(110),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(430),
                x: translatePxS(210),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(430),
                x: translatePxS(110),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(520),
                x: translatePxS(210),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(520),
                x: translatePxS(110),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            }],
            initLevel($this) {
                $this.GAME_PANEL.x = 50;
                $this.CURRENT_TARGET_NUM = 0;
                $this.TARGET_NUM = 9;
                $this.SCORE_BOARD.text = `${$this.CURRENT_TARGET_NUM}/${$this.TARGET_NUM}`
            },
            registerEvent(item,$this) {
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    $this.BOOM_SOUND.play(0,1);
                    item.texture = RES.getRes(`balloon_boom_png`);
                    $this.CURRENT_TARGET_NUM ++;
                    $this.SCORE_BOARD.text = `${$this.CURRENT_TARGET_NUM}/${$this.TARGET_NUM}`;
                    item.touchEnabled = false;
                    if($this.CURRENT_TARGET_NUM === $this.TARGET_NUM) {
                        setTimeout(() => {
                            $this.SUCCESS_MUSIC.play(0,1)
                        },500)
                        this.gameOver = true;
                        $this.showSuccessPage(this.type);
                    }
                }, $this);
            }
        },
        {
            level: 3,
            type: 'math',
            title: '请根据气球的数量选择正确的数字',
            gameOver:false,
            duration: 5000,
            qsList:[{
                imageUrl: 'balloon_png',
                y: translatePx(160),
                x: translatePx(50),
                width:translatePx(58),
                height: translatePx(79)
            },{
                imageUrl: 'balloon_png',
                y: translatePx(145),
                x: translatePx(150),
                width:translatePx(58),
                height: translatePx(79)
            },{
                imageUrl: 'balloon_png',
                y: translatePx(167),
                x: translatePx(267),
                width:translatePx(58),
                height: translatePx(79)
            },{
                imageUrl: 'balloon_png',
                y: translatePx(280),
                x: translatePx(60),
                width:translatePx(58),
                height: translatePx(79)
            },{
                imageUrl: 'balloon_png',
                y: translatePx(260),
                x: translatePx(200),
                width:translatePx(58),
                height: translatePx(79)
            },{
                imageUrl: 'balloon_png',
                y: translatePx(339),
                x: translatePx(142),
                width:translatePx(58),
                height: translatePx(79)
            },{
                imageUrl: 'balloon_png',
                y: translatePx(330),
                x: translatePx(266),
                width:translatePx(58),
                height: translatePx(79)
            }],
            targetList: [{
                imageUrl: 'as31_png',
                y: translatePx(468),
                x: translatePx(51),
                name:'as1',
                width:translatePx(64),
                height: translatePx(64)
            },{
                imageUrl: 'as32_png',
                y: translatePx(468),
                x: translatePx(155),
                name:'as2',
                width:translatePx(64),
                height: translatePx(64)
            },{
                imageUrl: 'as33_png',
                y: translatePx(468),
                x: translatePx(259),
                name:'as3',
                width:translatePx(64),
                height: translatePx(64)
            }],
            initLevel($this){
                $this.GAME_PANEL.x = 0;
                $this.BASE_COMP.removeChild($this.SCORE_WRAPPER);
                $this.BASE_COMP.removeChild($this.SCORE_BOARD);
            },
            registerEvent(item,$this) { 
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    this.gameOver = true;
                    if(item.name === 'as3'){
                        item.texture = RES.getRes(`as31_boom_png`);
                        setTimeout(() => {
                            $this.SUCCESS_MUSIC.play(0,1)
                        },500)
                        $this.showSuccessPage(this.type);
                    }else {
                        $this.showFailPage();
                    }
                }, $this);
            }
        },
        {
            level: 4,
            type: 'math',
            gameOver:false,
            duration: 4000,
            title: '请选择数字对应的数量',
            qsList:[{
                imageUrl: 'qs4_png',
                y: translatePx(240),
                x: translatePx(160),
                width:translatePx(53),
                height: translatePx(74)
            }],
            special:{
                imageUrl: 'qs42_png',
                y: translatePx(240),
                x: translatePx(160),
                width:translatePx(52),
                height: translatePx(74)
            },
            targetList: [{
                imageUrl: 'as41_png',
                y: translatePx(397),
                x: translatePx(40),
                name:'as1',
                width:translatePx(88),
                height: translatePx(88)
            },{
                imageUrl: 'as42_png',
                y: translatePx(397),
                x: translatePx(148),
                name:'as2',
                width:translatePx(88),
                height: translatePx(88)
            },{
                imageUrl: 'as43_png',
                y: translatePx(397),
                x: translatePx(256),
                name:'as3',
                width:translatePx(88),
                height: translatePx(88)
            }],
            flyImage:{
                y: translatePx(397),
                x: translatePx(40),
                imageUrl: 'fy41_png',
                width:translatePx(81),
                height: translatePx(81)
            },
            target: {
                x: translatePx(160),
                y: translatePx(240),
                width:translatePx(81),
                height: translatePx(81)
            },
            initLevel($this){
                
            },
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    this.gameOver = true;
                    if(item.name === 'as1'){
                        $this.SUCCESS_MUSIC.play(0,1)
                        $this.flyAnimation2(this.flyImage, this.target, () => {
                            $this.showSuccessPage(this.type);
                        },this.special)
                    }else {
                        $this.showFailPage();
                    }
                }, $this);
            }
        },
        {   
            level: 5,
            type: 'math',
            gameOver:false,
            duration: 6000,
            title: '请听语音点击正确的气球数量',
            targetList: [{
                imageUrl: 'balloon_png',
                y: translatePxS(160),
                x: translatePxS(110),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(160),
                x: translatePxS(210),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(250),
                x: translatePxS(110),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(250),
                x: translatePxS(210),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(340),
                x: translatePxS(210),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(340),
                x: translatePxS(110),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(430),
                x: translatePxS(210),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(430),
                x: translatePxS(110),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(520),
                x: translatePxS(210),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            },{
                imageUrl: 'balloon_png',
                y: translatePxS(520),
                x: translatePxS(110),
                width:translatePxS(58),
                height: translatePxS(79),
                afterClick: 'balloon_boom_png'
            }],
            initLevel($this) {
                $this.GAME_PANEL.x = 50;
                $this.BASE_COMP.addChild($this.SCORE_WRAPPER);
                $this.BASE_COMP.addChild($this.SCORE_BOARD);
                $this.CURRENT_TARGET_NUM = 0;
                $this.TARGET_NUM = 2;
                $this.SCORE_BOARD.text = `${$this.CURRENT_TARGET_NUM}/${$this.TARGET_NUM}`
            },
            registerEvent(item,$this) {
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    $this.BOOM_SOUND.play(0,1);
                    item.texture = RES.getRes(`balloon_boom_png`);
                    $this.CURRENT_TARGET_NUM ++;
                    $this.SCORE_BOARD.text = `${$this.CURRENT_TARGET_NUM}/${$this.TARGET_NUM}`;
                    item.touchEnabled = false;
                    if($this.CURRENT_TARGET_NUM === $this.TARGET_NUM) {
                        this.gameOver = true;
                        setTimeout(() => {
                            $this.SUCCESS_MUSIC.play(0,1)
                        },500)
                        $this.showSuccessPage(this.type);
                    }
                }, $this);
            }
        },{   
            level: 6,
            type: 'illation',
            gameOver:false,
            title: '请仔细观察，空白处应该放哪一个',
            duration: 5000,
            qsList:[{
                imageUrl: 'qs61_png',
                y: this.translatePx(146),
                x: this.translatePx(31),
                width:this.translatePx(48),
                height: this.translatePx(48)
            },{
                imageUrl: 'qs62_png',
                y: this.translatePx(146),
                x: this.translatePx(84),
                width:this.translatePx(48),
                height: this.translatePx(48)
            },{
                imageUrl: 'qs61_png',
                y: this.translatePx(146),
                x: this.translatePx(137),
                width:this.translatePx(48),
                height: this.translatePx(48)
            },{
                imageUrl: 'qs63_png',
                y: this.translatePx(146),
                x: this.translatePx(190),
                width:this.translatePx(48),
                height: this.translatePx(48)
            },{
                imageUrl: 'qs61_png',
                y: this.translatePx(146),
                x: this.translatePx(243),
                width:this.translatePx(48),
                height: this.translatePx(48)
            },{
                imageUrl: 'qs63_png',
                y: this.translatePx(146),
                x: this.translatePx(296),
                width:this.translatePx(48),
                height: this.translatePx(48)
            }],
            targetList: [{
                imageUrl: 'qs61_png',
                y: this.translatePx(421),
                x: this.translatePx(94),
                name:'as1',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs63_png',
                y: this.translatePx(421),
                x: this.translatePx(218),
                name:'as2',
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            flyImage:{
                y: this.translatePx(438),
                x: this.translatePx(238),
                imageUrl: 'fy61_png',
                width:this.translatePx(24),
                height: this.translatePx(29.6)
            },
            target: {
                x: translatePx(96),
                y: translatePx(155),
                width:this.translatePx(24),
                height: this.translatePx(30)
            },
            initLevel($this){
                $this.GAME_PANEL.x = 0;
                $this.BASE_COMP.removeChild($this.SCORE_WRAPPER);
                $this.BASE_COMP.removeChild($this.SCORE_BOARD);
            },
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    this.gameOver = true;
                    if(item.name === 'as2'){
                        $this.SUCCESS_MUSIC.play(0,1)
                        $this.flyAnimation(this.flyImage, this.target, () => {
                            $this.showSuccessPage(this.type);
                        })
                    }else {
                        $this.showFailPage();
                    }
                }, $this);
            }
        },{   
            level: 7,
            type: 'illation',
            gameOver:false,
            duration: 5000,
            title: '请仔细观察，空白处应该放哪一个',
            qsList:[{
                imageUrl: 'qs71_png',
                y: this.translatePx(146),
                x: this.translatePx(31),
                width:this.translatePx(48),
                height: this.translatePx(48)
            },{
                imageUrl: 'qs62_png',
                y: this.translatePx(146),
                x: this.translatePx(84),
                width:this.translatePx(48),
                height: this.translatePx(48)
            },{
                imageUrl: 'qs71_png',
                y: this.translatePx(146),
                x: this.translatePx(137),
                width:this.translatePx(48),
                height: this.translatePx(48)
            },{
                imageUrl: 'qs72_png',
                y: this.translatePx(146),
                x: this.translatePx(190),
                width:this.translatePx(48),
                height: this.translatePx(48)
            },{
                imageUrl: 'qs71_png',
                y: this.translatePx(146),
                x: this.translatePx(243),
                width:this.translatePx(48),
                height: this.translatePx(48)
            },{
                imageUrl: 'qs72_png',
                y: this.translatePx(146),
                x: this.translatePx(296),
                width:this.translatePx(48),
                height: this.translatePx(48)
            }],
            targetList: [{
                imageUrl: 'qs71_png',
                y: this.translatePx(421),
                x: this.translatePx(51),
                name:'as1',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs72_png',
                y: this.translatePx(421),
                x: this.translatePx(155),
                name:'as2',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs73_png',
                y: this.translatePx(421),
                x: this.translatePx(259),
                name:'as3',
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            flyImage:{
                y: this.translatePx(438),
                x: this.translatePx(172),
                imageUrl: 'fy71_png',
                width:this.translatePx(30),
                height: this.translatePx(30)
            },
            target: {
                x: translatePx(96),
                y: translatePx(158),
                width:this.translatePx(24),
                height: this.translatePx(24)
            },
            initLevel($this){
            },
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    this.gameOver = true;
                    if(item.name === 'as2'){
                        $this.SUCCESS_MUSIC.play(0,1)
                        $this.flyAnimation(this.flyImage, this.target, () => {
                            $this.showSuccessPage(this.type);
                        })
                    }else {
                        $this.showFailPage();
                    }
                }, $this);
            }
        },{   
            level: 8,
            type: 'illation',
            gameOver:false,
            duration: 7000,
            title: '请仔细观察，选择正确的答案，拖拽到空白处',
            qsList:[{
                imageUrl: 'qs81_png',
                y: this.translatePx(147),
                x: this.translatePx(94),
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs82_png',
                y: this.translatePx(147),
                x: this.translatePx(218),
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs83_png',
                y: this.translatePx(231),
                x: this.translatePx(94),
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs84_png',
                y: this.translatePx(231),
                x: this.translatePx(218),
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs85_png',
                y: this.translatePx(321),
                x: this.translatePx(94),
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs86_png',
                y: this.translatePx(321),
                x: this.translatePx(218),
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            targetList: [{
                imageUrl: 'as81_png',
                y: this.translatePx(421),
                x: this.translatePx(51),
                name:'as1',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as82_png',
                y: this.translatePx(421),
                x: this.translatePx(155),
                name:'as2',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as83_png',
                y: this.translatePx(421),
                x: this.translatePx(259),
                name:'as3',
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            isCollideWith(origin, target) {
                let spX = origin.x + origin.width / 2;
                let spY = origin.y + origin.height / 2;
                return !!(   spX >= target.x
                        && spX <= target.x + target.width
                        && spY >= target.y
                        && spY <= target.y + target.height  )
            },
            initLevel(){

            },
            registerEvent(item,$this) {
                let that = this;
                let oldX = item.x;
                let oldY = item.y;
                let target = that.qsList[5];
                let _distance:egret.Point = new egret.Point();
                let _touchStatus = false;

                item.addEventListener(egret.TouchEvent.TOUCH_BEGIN, (evt) => {
                    if(that.gameOver) return;
                    _touchStatus = true;
                    _distance.x = evt.stageX - item.x;
                    _distance.y = evt.stageY - item.y;
                    $this.addChild($this.TOUCH_AREA)
                    $this.TOUCH_AREA.addEventListener(egret.TouchEvent.TOUCH_MOVE, mouseMove, this);
                    $this.TOUCH_AREA.addEventListener(egret.TouchEvent.TOUCH_END, mouseUp, this);
                }, this);

                function mouseUp(evt) {
                    if(that.isCollideWith(item,target)){
                        item.x = target.x;
                        item.y = target.y;
                        that.gameOver = true;
                        if(item.name === 'as2'){
                            $this.SUCCESS_MUSIC.play(0,1)
                            $this.showSuccessPage(that.type);
                        }else {
                            $this.showFailPage();
                        }
                    }else {
                        item.x = oldX;
                        item.y = oldY;
                    }
                    _touchStatus = false;
                    $this.TOUCH_AREA.removeEventListener(egret.TouchEvent.TOUCH_MOVE, mouseMove, this);
                    $this.TOUCH_AREA.removeEventListener(egret.TouchEvent.TOUCH_END, mouseUp, this);
                    $this.removeChild($this.TOUCH_AREA)
                }

                function mouseMove(evt) {
                    if( _touchStatus ){
                        item.x = evt.stageX - _distance.x;
                        item.y = evt.stageY - _distance.y;
                    }
                }
            }
        },{   
            level: 9,
            type: 'illation',
            gameOver:false,
            duration: 7000,
            title: '请仔细观察，选择正确的答案，拖拽到空白处',
            qsList:[{
                imageUrl: 'qs91_png',
                y: this.translatePx(147),
                x: this.translatePx(94),
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs92_png',
                y: this.translatePx(147),
                x: this.translatePx(218),
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs93_png',
                y: this.translatePx(231),
                x: this.translatePx(94),
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs94_png',
                y: this.translatePx(231),
                x: this.translatePx(218),
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs95_png',
                y: this.translatePx(321),
                x: this.translatePx(94),
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs96_png',
                y: this.translatePx(321),
                x: this.translatePx(218),
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            targetList: [{
                imageUrl: 'as91_png',
                y: this.translatePx(421),
                x: this.translatePx(51),
                name:'as1',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as92_png',
                y: this.translatePx(421),
                x: this.translatePx(155),
                name:'as2',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as93_png',
                y: this.translatePx(421),
                x: this.translatePx(259),
                name:'as3',
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            isCollideWith(origin, target) {
                let spX = origin.x + origin.width / 2;
                let spY = origin.y + origin.height / 2;
                return !!(   spX >= target.x
                        && spX <= target.x + target.width
                        && spY >= target.y
                        && spY <= target.y + target.height  )
            },
            initLevel(){

            },
            registerEvent(item,$this) {
                let that = this;
                let oldX = item.x;
                let oldY = item.y;
                let target = that.qsList[5];
                let _distance:egret.Point = new egret.Point();
                let _touchStatus = false;

                item.addEventListener(egret.TouchEvent.TOUCH_BEGIN, (evt) => {
                    if(that.gameOver) return;
                    _touchStatus = true;
                    _distance.x = evt.stageX - item.x;
                    _distance.y = evt.stageY - item.y;
                    $this.addChild($this.TOUCH_AREA)
                    $this.TOUCH_AREA.addEventListener(egret.TouchEvent.TOUCH_MOVE, mouseMove, this);
                    $this.TOUCH_AREA.addEventListener(egret.TouchEvent.TOUCH_END, mouseUp, this);
                }, this);

                function mouseUp(evt) {
                    if(that.isCollideWith(item,target)){
                        item.x = target.x;
                        item.y = target.y;
                        that.gameOver = true;
                        if(item.name === 'as2'){
                            $this.SUCCESS_MUSIC.play(0,1)
                            $this.showSuccessPage(that.type);
                        }else {
                            $this.showFailPage();
                        }
                    }else {
                        item.x = oldX;
                        item.y = oldY;
                    }
                    _touchStatus = false;
                    $this.TOUCH_AREA.removeEventListener(egret.TouchEvent.TOUCH_MOVE, mouseMove, this);
                    $this.TOUCH_AREA.removeEventListener(egret.TouchEvent.TOUCH_END, mouseUp, this);
                    $this.removeChild($this.TOUCH_AREA)
                }

                function mouseMove(evt) {
                    if( _touchStatus ){
                        item.x = evt.stageX - _distance.x;
                        item.y = evt.stageY - _distance.y;
                    }
                }
            }
        },{   
            level: 10,
            type: 'illation',
            gameOver:false,
            duration: 5000,
            title: '请仔细观察，空白处应该放哪一个',
            qsList:[{
                imageUrl: 'qs101_png',
                y: this.translatePx(147),
                x: this.translatePx(48),
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs102_png',
                y: this.translatePx(147),
                x: this.translatePx(120),
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs103_png',
                y: this.translatePx(147),
                x: this.translatePx(192),
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'qs62_png',
                y: this.translatePx(147),
                x: this.translatePx(264),
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            targetList: [{
                imageUrl: 'as101_png',
                y: this.translatePx(420),
                x: this.translatePx(94),
                name:'as1',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as102_png',
                y: this.translatePx(420),
                x: this.translatePx(218),
                name:'as2',
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            flyImage:{
                y: this.translatePx(434),
                x: this.translatePx(229),
                imageUrl: 'fy101_png',
                width:this.translatePx(43),
                height: this.translatePx(38)
            },
            target: {
                x: translatePx(272),
                y: translatePx(158),
                width:this.translatePx(48),
                height: this.translatePx(44)
            },
            initLevel($this){

            },
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    this.gameOver = true;
                    if(item.name === 'as2'){
                        $this.SUCCESS_MUSIC.play(0,1)
                        $this.flyAnimation(this.flyImage, this.target, () => {
                            $this.showSuccessPage(this.type);
                        })
                    }else {
                        $this.showFailPage();
                    }
                }, $this);
            }
        },{   
            level: 11,
            type: 'observation',
            gameOver:false,
            duration: 5000,
            title: '请仔细观察，下面是谁的影子？',
            qsList:[{
                imageUrl: 'qs111_png',
                y: this.translatePx(153),
                x: this.translatePx(90),
                width:this.translatePx(192),
                height: this.translatePx(192)
            }],
            targetList: [{
                imageUrl: 'as111_png',
                y: this.translatePx(421),
                x: this.translatePx(52),
                name:'as1',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as112_png',
                y: this.translatePx(421),
                x: this.translatePx(156),
                name:'as2',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as113_png',
                y: this.translatePx(421),
                x: this.translatePx(260),
                name:'as3',
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            flyImage:{
                y: this.translatePx(438),
                x: this.translatePx(174),
                imageUrl: 'fy111_png',
                width:this.translatePx(28),
                height: this.translatePx(30)
            },
            target: {
                x: translatePx(132),
                y: translatePx(190),
                width:this.translatePx(112),
                height: this.translatePx(120)
            },
            initLevel($this){

            },
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    this.gameOver = true;
                    if(item.name === 'as2'){
                        $this.SUCCESS_MUSIC.play(0,1)
                        $this.flyAnimation(this.flyImage, this.target, () => {
                            $this.showSuccessPage(this.type);
                        })
                    }else {
                        $this.showFailPage();
                    }
                }, $this);
            }
        },{   
            level: 12,
            type: 'observation',
            gameOver:false,
            duration: 5000,
            title: '请仔细观察，缺的是哪一块',
            qsList:[{
                imageUrl: 'qs121_png',
                y: this.translatePx(153),
                x: this.translatePx(90),
                width:this.translatePx(192),
                height: this.translatePx(192)
            }],
            targetList: [{
                imageUrl: 'as121_png',
                y: this.translatePx(420),
                x: this.translatePx(94),
                name:'as1',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as122_png',
                y: this.translatePx(420),
                x: this.translatePx(218),
                name:'as2',
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            flyImage:{
                y: this.translatePx(441),
                x: this.translatePx(224),
                imageUrl: 'fy121_png',
                width:this.translatePx(53),
                height: this.translatePx(23)
            },
            target: {
                x: translatePx(120),
                y: translatePx(209),
                width:this.translatePx(110),
                height: this.translatePx(43)
            },
            initLevel($this){

            },
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    this.gameOver = true;
                    if(item.name === 'as2'){
                        $this.SUCCESS_MUSIC.play(0,1)
                        $this.flyAnimation(this.flyImage, this.target, () => {
                            $this.showSuccessPage(this.type);
                        })
                    }else {
                        $this.showFailPage();
                    }
                }, $this);
            }
        },{   
            level: 13,
            type: 'observation',
            gameOver:false,
            duration: 5000,
            title: '请仔细观察，缺的是哪一块',
            qsList:[{
                imageUrl: 'qs131_png',
                y: this.translatePx(153),
                x: this.translatePx(90),
                width:this.translatePx(192),
                height: this.translatePx(192)
            }],
            targetList: [{
                imageUrl: 'as131_png',
                y: this.translatePx(421),
                x: this.translatePx(30),
                name:'as1',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as132_png',
                y: this.translatePx(421),
                x: this.translatePx(114),
                name:'as2',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as133_png',
                y: this.translatePx(421),
                x: this.translatePx(198),
                name:'as3',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as134_png',
                y: this.translatePx(421),
                x: this.translatePx(282),
                name:'as4',
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            flyImage:{
                y: this.translatePx(438),
                x: this.translatePx(48),
                imageUrl: 'fy131_png',
                width:this.translatePx(30),
                height: this.translatePx(30)
            },
            target: {
                x: translatePx(108),
                y: translatePx(201),
                width:this.translatePx(83),
                height: this.translatePx(83)
            },
            initLevel($this){

            },
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    this.gameOver = true;
                    if(item.name === 'as1'){
                        $this.SUCCESS_MUSIC.play(0,1)
                        $this.flyAnimation(this.flyImage, this.target, () => {
                            $this.showSuccessPage(this.type);
                        })
                    }else {
                        $this.showFailPage();
                    }
                }, $this);
            }
        },{
            level: 14,
            type: 'observation',
            gameOver:false,
            duration: 7000,
            title: '下图中有两处不符合常理的，请把它们点出来',
            qsList:[{
                imageUrl: 'qs14_png',
                y: this.translatePx(153),
                x: 20,
                width:600,
                height: 600
            }],
            targetList: [{
                imageUrl: 'as141_png',
                y: 205 + this.translatePx(153),
                x: 48,
                name:'as1',
                width:274,
                height: 147
            },{
                imageUrl: 'as142_png',
                y: 412 + this.translatePx(153),
                x: 527,
                name:'as2',
                width:23,
                height: 57
            }],
            as1: false,
            as2: false,
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    if(item.name === 'as1' && !this.as1) {
                        $this.SUCCESS_MUSIC.play(0,1)
                        this.as1 = true;
                        item.texture = RES.getRes(`as1411_png`);
                        item.height = 126;
                        item.y = 226 + translatePx(153);
                    }else if(item.name === 'as2' && !this.as2){
                        $this.SUCCESS_MUSIC.play(0,1)
                        this.as2 = true;
                        item.texture = RES.getRes(`as1421_png`);
                        item.width = 52;
                        item.height = 57;
                        item.x = 510;
                        item.y = 412 + translatePx(153);
                    }
                    if(this.as1 && this.as2){
                        this.gameOver = true;
                        $this.showSuccessPage(this.type);
                    }
                }, $this);
            }
        },{
            level: 15,
            type: 'observation',
            gameOver:false,
            duration: 7000,
            title: '下图中有三处不符合常理的，请把它们点出来',
            qsList:[{
                imageUrl: 'qs15_png',
                y: this.translatePx(153),
                x: 20,
                width:600,
                height: 600
            }],
            targetList: [{
                imageUrl: 'as151_png',
                y:365 + this.translatePx(153),
                x: 115,
                name:'as1',
                width:346,
                height: 141
            },{
                imageUrl: 'as152_png',
                y:462 + this.translatePx(153),
                x: 480,
                name:'as2',
                width: 61,
                height: 45
            },{
                imageUrl: 'as153_png',
                y: 445 + this.translatePx(153),
                x: 522,
                name:'as3',
                width: 59,
                height: 123
            }],
            as1: false,
            as2: false,
            as3: false,
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    if(item.name === 'as1' && !this.as1) {
                        $this.SUCCESS_MUSIC.play(0,1)
                        this.as1 = true;
                        item.texture = RES.getRes(`as1511_png`);
                        item.width = 280;
                        item.height = 280;
                        item.x = 186;
                        item.y = 239 + translatePx(153);
                    }else if(item.name === 'as2' && !this.as2){
                        $this.SUCCESS_MUSIC.play(0,1)
                        this.as2 = true;
                        item.texture = RES.getRes(`as1521_png`);
                        item.width = 144;
                        item.height = 192;
                        item.x = 431
                        item.y = 332 + translatePx(153);
                    }else if(item.name === 'as3' && !this.as3){
                        $this.SUCCESS_MUSIC.play(0,1);
                        item.width = 29;
                        item.height = 74;
                        item.x = 556
                        item.y = 466 + translatePx(153);
                        this.as3 = true;
                        item.texture = RES.getRes(`as1531_png`);
                    }
                    if(this.as1 && this.as2 && this.as3){
                        this.gameOver = true;
                        $this.showSuccessPage(this.type);
                    }
                }, $this);
            }
        },{   
            level: 16,
            type: 'space',
            gameOver:false,
            duration: 8000,
            title: '请仔细观察下面的图是由哪些图片组成，点一点',
            qsList:[{
                imageUrl: 'qs161_png',
                y: this.translatePx(153),
                x: this.translatePx(90),
                width:this.translatePx(192),
                height: this.translatePx(192)
            }],
            targetList: [{
                imageUrl: 'as161_png',
                y: this.translatePx(421),
                x: this.translatePx(52),
                name:'as1',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as162_png',
                y: this.translatePx(421),
                x: this.translatePx(156),
                name:'as2',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as163_png',
                y: this.translatePx(421),
                x: this.translatePx(260),
                name:'as3',
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            as1:false,
            as2:false,
            initLevel(){

            },
            registerEvent(item,$this) { 
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return 
                    if(item.name === 'as1'){
                        this.as1 = true;
                        item.touchEnabled = false;
                        $this.SUCCESS_MUSIC.play(0,1);
                        item.texture = RES.getRes(`as161_boom_png`);
                        if(this.as1 && this.as2){
                            this.gameOver = true;
                            $this.showSuccessPage(this.type);
                        }
                    }else if(item.name === 'as2') {
                        this.as2 = true;
                        item.touchEnabled = false;
                        $this.SUCCESS_MUSIC.play(0,1)
                        item.texture = RES.getRes(`as162_boom_png`);
                        if(this.as1 && this.as2){
                            this.gameOver = true;
                            $this.showSuccessPage(this.type);
                        }
                    }else {
                        this.gameOver = true;
                        $this.showFailPage();
                    }
                }, $this);
            }
        },{   
            level: 17,
            type: 'space',
            gameOver:false,
            duration: 8000,
            title: '请仔细观察下面的图是由哪些图片组成，点一点',
            qsList:[{
                imageUrl: 'qs171_png',
                y: this.translatePx(153),
                x: this.translatePx(90),
                width:this.translatePx(192),
                height: this.translatePx(192)
            }],
            targetList: [{
                imageUrl: 'as171_png',
                y: this.translatePx(421),
                x: this.translatePx(52),
                name:'as1',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as172_png',
                y: this.translatePx(421),
                x: this.translatePx(156),
                name:'as2',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as173_png',
                y: this.translatePx(421),
                x: this.translatePx(260),
                name:'as3',
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            as1:false,
            as2:false,
            initLevel(){

            },
            registerEvent(item,$this) { 
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return 
                    if(item.name === 'as1'){
                        this.as1 = true;
                        item.touchEnabled = false;
                        $this.SUCCESS_MUSIC.play(0,1);
                        item.texture = RES.getRes(`as171_boom_png`);
                        if(this.as1 && this.as2){
                            this.gameOver = true;
                            $this.showSuccessPage(this.type);
                        }
                    }else if(item.name === 'as3') {
                        this.as2 = true;
                        item.touchEnabled = false;
                        $this.SUCCESS_MUSIC.play(0,1)
                        item.texture = RES.getRes(`as173_boom_png`);
                        if(this.as1 && this.as2){
                            this.gameOver = true;
                            $this.showSuccessPage(this.type);
                        }
                    }else {
                        this.gameOver = true;
                        $this.showFailPage();
                    }
                }, $this);
            }
        },{   
            level: 18,
            type: 'space',
            duration: 6000,
            gameOver:false,
            title: '请仔细观察图中少了哪些图形，点出来',
            qsList:[{
                imageUrl: 'qs181_png',
                y: this.translatePx(153),
                x: this.translatePx(90),
                width:this.translatePx(192),
                height: this.translatePx(192)
            }],
            targetList: [{
                imageUrl: 'as181_png',
                y: this.translatePx(421),
                x: this.translatePx(52),
                name:'as1',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as182_png',
                y: this.translatePx(421),
                x: this.translatePx(156),
                name:'as2',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as183_png',
                y: this.translatePx(421),
                x: this.translatePx(260),
                name:'as3',
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            flyImage:{
                y: this.translatePx(438),
                x: this.translatePx(59),
                imageUrl: 'fy181_png',
                width:this.translatePx(30),
                height: this.translatePx(30)
            },
            target: {
                x: translatePx(99),
                y: translatePx(206),
                width:this.translatePx(88),
                height: this.translatePx(88)
            },
            initLevel($this){

            },
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    this.gameOver = true;
                    if(item.name === 'as1'){
                        $this.SUCCESS_MUSIC.play(0,1)
                        $this.flyAnimation(this.flyImage, this.target, () => {
                            $this.showSuccessPage(this.type);
                        })
                    }else {
                        $this.showFailPage();
                    }
                }, $this);
            }
        },{   
            level: 19,
            type: 'space',
            duration: 6000,
            gameOver:false,
            title: '请仔细观察图中少了哪些图形，点出来',
            qsList:[{
                imageUrl: 'qs191_png',
                y: this.translatePx(153),
                x: this.translatePx(90),
                width:this.translatePx(192),
                height: this.translatePx(192)
            }],
            targetList: [{
                imageUrl: 'as191_png',
                y: this.translatePx(421),
                x: this.translatePx(52),
                name:'as1',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as192_png',
                y: this.translatePx(421),
                x: this.translatePx(156),
                name:'as2',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as193_png',
                y: this.translatePx(421),
                x: this.translatePx(260),
                name:'as3',
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            as1:false,
            as2:false,
            flyImage:{
                y: this.translatePx(438),
                x: this.translatePx(69), 
                imageUrl: 'fy192_png',
                width:this.translatePx(30),
                height: this.translatePx(30)
            },
            target: {
                x: translatePx(123),
                y: translatePx(170),
                width:this.translatePx(64),
                height: this.translatePx(64)
            },
            flyImage2:{
                y: this.translatePx(438),
                x: this.translatePx(166),
                imageUrl: 'fy191_png',
                width:this.translatePx(30),
                height: this.translatePx(30)
            },
            target2: {
                x: translatePx(124),
                y: translatePx(219),
                width:this.translatePx(95),
                height: this.translatePx(47)
            },
            initLevel($this){

            },
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    if(item.name === 'as1'){
                        $this.SUCCESS_MUSIC.play(0,1)
                        this.as1 = true;
                        item.touchEnabled = false;
                        $this.flyAnimation(this.flyImage, this.target, () => {
                            if(this.as1 && this.as2){
                                this.gameOver = true;
                                $this.showSuccessPage(that.type);
                            }
                        })
                    }else if(item.name === 'as2'){
                        $this.SUCCESS_MUSIC.play(0,1)
                        this.as2 = true;
                        item.touchEnabled = false;
                        $this.flyAnimation(this.flyImage2, this.target2, () => {
                            if(this.as1 && this.as2){
                                this.gameOver = true;
                                $this.showSuccessPage(that.type);
                            }
                        })
                    }else {
                        this.gameOver = true;
                        $this.showFailPage();
                    }
                }, $this);
            }
        },{   
            level: 20,
            type: 'space',
            gameOver:false,
            duration: 6000,
            title: '请仔细观察下面的图是由abc哪组图形组成的？',
            qsList:[{
                imageUrl: 'qs201_png',
                y: this.translatePx(153),
                x: this.translatePx(90),
                width:this.translatePx(192),
                height: this.translatePx(192)
            }],
            targetList: [{
                imageUrl: 'as201_png',
                y: this.translatePx(421),
                x: this.translatePx(52),
                name:'as1',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as202_png',
                y: this.translatePx(421),
                x: this.translatePx(156),
                name:'as2',
                width:this.translatePx(64),
                height: this.translatePx(64)
            },{
                imageUrl: 'as203_png',
                y: this.translatePx(421),
                x: this.translatePx(260),
                name:'as3',
                width:this.translatePx(64),
                height: this.translatePx(64)
            }],
            initLevel(){

            },
            registerEvent(item,$this) { 
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    this.gameOver = true;
                    if(item.name === 'as1'){
                        $this.SUCCESS_MUSIC.play(0,1)
                        item.texture = RES.getRes(`as2011_png`);
                        $this.showSuccessPage(this.type);
                    }else {
                        $this.showFailPage();
                    }
                }, $this);
            }
        },{   
            level: 21,
            type: 'memory',
            gameOver:false,
            title: '请你记住桌子上的物品',
            title2: '请你回忆刚才的画面，想一想桌上什么不见了',
            duration1: 4000,
            duration:7000,
            preList: [{
                imageUrl: 'qs211_png',
                y: translatePxS(153),
                x: translatePxS(58),
                width:translatePxS(260),
                height: translatePxS(260)
            }],
            qsList:[{
                imageUrl: 'qs212_png',
                y: translatePxS(153),
                x: translatePxS(58),
                width:translatePxS(260),
                height: translatePxS(260)
            }],
            targetList: [{
                imageUrl: 'as211_png',
                y: translatePxS(488),
                x: translatePxS(52),
                name:'as1',
                width:translatePxS(64),
                height: translatePxS(64)
            },{
                imageUrl: 'as212_png',
                y: translatePxS(488),
                x: translatePxS(156),
                name:'as2',
                width:translatePxS(64),
                height: translatePxS(64)
            },{
                imageUrl: 'as213_png',
                y: translatePxS(488),
                x: translatePxS(260),
                name:'as3',
                width:translatePxS(64),
                height: translatePxS(64)
            }],
            flyImage:{
                y: translatePxS(497),
                x: translatePxS(165),
                imageUrl: 'fy211_png',
                width:translatePxS(46),
                height: translatePxS(46)
            },
            target: {
                x: translatePxS(141),
                y: translatePxS(215),
                width:translatePxS(46),
                height: translatePxS(46)
            },
            initLevel($this){
                $this.GAME_PANEL.x = 50;
            },
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    this.gameOver = true;
                    if(item.name === 'as2'){
                        $this.SUCCESS_MUSIC.play(0,1)
                        $this.flyAnimation(this.flyImage, this.target, () => {
                            $this.showSuccessPage(this.type);
                        })
                    }else {
                        $this.showFailPage();
                    }
                }, $this);
            }
        },{   
            level: 22,
            type: 'memory',
            gameOver:false,
            duration1: 4000,
            duration:7000,
            title: '请你记住桌子上的物品',
            title2: '请你回忆刚才的画面，想一想桌上什么不见了',
            preList: [{
                imageUrl: 'qs221_png',
                y: translatePxS(153),
                x: translatePxS(58),
                width:translatePxS(260),
                height: translatePxS(260)
            }],
            qsList:[{
                imageUrl: 'qs222_png',
                y: translatePxS(153),
                x: translatePxS(58),
                width:translatePxS(260),
                height: translatePxS(260)
            }],
            targetList: [{
                imageUrl: 'as221_png',
                y: translatePxS(488),
                x: translatePxS(52),
                name:'as1',
                width:translatePxS(64),
                height: translatePxS(64)
            },{
                imageUrl: 'as213_png',
                y: translatePxS(488),
                x: translatePxS(156),
                name:'as2',
                width:translatePxS(64),
                height: translatePxS(64)
            },{
                imageUrl: 'as223_png',
                y: translatePxS(488),
                x: translatePxS(260),
                name:'as3',
                width:translatePxS(64),
                height: translatePxS(64)
            }],
            flyImage:{
                y: translatePxS(497),
                x: translatePxS(61),
                imageUrl: 'fy221_png',
                width:translatePxS(46),
                height: translatePxS(46)
            },
            target: {
                x: translatePxS(141),
                y: translatePxS(215),
                width:translatePxS(46),
                height: translatePxS(46)
            },
            initLevel($this){

            },
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return;
                    this.gameOver = true;
                    if(item.name === 'as1'){
                        $this.SUCCESS_MUSIC.play(0,1)
                        $this.flyAnimation(this.flyImage, this.target, () => {
                            $this.showSuccessPage(this.type);
                        })
                    }else {
                        $this.showFailPage();
                    }
                }, $this);
            }
        },{   
            level: 23,
            type: 'memory',
            gameOver:false,
            duration1: 5000,
            duration:5000,
            title: '请仔细观察，记住食物的位置',
            title2: '请你回忆画面中食物的位置，点一点',
            preList: [{
                imageUrl: 'qs231_png',
                y: this.translatePx(153),
                x: this.translatePx(48),
                width:this.translatePx(120),
                height: this.translatePx(120)
            },{
                imageUrl: 'qs231_png',
                y: this.translatePx(153),
                x: this.translatePx(208),
                width:this.translatePx(120),
                height: this.translatePx(120)
            },{
                imageUrl: 'qs231_png',
                y: this.translatePx(293),
                x: this.translatePx(48),
                width:this.translatePx(120),
                height: this.translatePx(120)
            },{
                imageUrl: 'qs242_png',
                y: this.translatePx(293),
                x: this.translatePx(208),
                width:this.translatePx(120),
                height: this.translatePx(120)
            }],
            targetList: [{
                imageUrl: 'as231_png',
                y: this.translatePx(153),
                x: this.translatePx(48),
                name:'as1',
                width:this.translatePx(120),
                height: this.translatePx(120)
            },{
                imageUrl: 'as231_png',
                y: this.translatePx(153),
                x: this.translatePx(208),
                name:'as2',
                width:this.translatePx(120),
                height: this.translatePx(120)
            },{
                imageUrl: 'as231_png',
                y: this.translatePx(293),
                x: this.translatePx(48),
                name:'as3',
                width:this.translatePx(120),
                height: this.translatePx(120)
            },{
                imageUrl: 'as231_png',
                y: this.translatePx(293),
                x: this.translatePx(208),
                name:'as4',
                width:this.translatePx(120),
                height: this.translatePx(120)
            }],
            as1:false,
            as2:false,
            as3:false,
            initLevel($this){
                $this.GAME_PANEL.x = 0;
            },
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return 
                    item.touchEnabled = false;
                    if(item.name !== 'as4'){
                        $this.SUCCESS_MUSIC.play(0,1)
                        that[item.name] = true
                        item.texture = RES.getRes(`qs231_png`);
                        if(that.as1 && that.as2 && that.as3){
                            this.gameOver = true;
                            $this.showSuccessPage(that.type);
                        }
                    }else {
                        this.gameOver = true;
                        item.texture = RES.getRes(`qs232_png`);
                        $this.showFailPage();
                    }

                }, $this);
            }
        },{   
            level: 24,
            type: 'memory',
            gameOver:false,
            duration1: 5000,
            duration:5000,
            title: '请仔细观察，记住食物的位置',
            title2: '请你回忆画面中食物的位置，点一点',
            preList:[{
                imageUrl: 'qs232_png',
                y: this.translatePx(157),
                x: this.translatePx(40),
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'qs241_png',
                y: this.translatePx(157),
                x: this.translatePx(143),
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'qs232_png',
                y: this.translatePx(157),
                x: this.translatePx(246),
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'qs241_png',
                y: this.translatePx(256),
                x: this.translatePx(40),
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'qs241_png',
                y: this.translatePx(256),
                x: this.translatePx(143),
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'qs232_png',
                y: this.translatePx(256),
                x: this.translatePx(246),
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'qs232_png',
                y: this.translatePx(360),
                x: this.translatePx(40),
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'qs241_png',
                y: this.translatePx(360),
                x: this.translatePx(143),
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'qs232_png',
                y: this.translatePx(360),
                x: this.translatePx(246),
                width:this.translatePx(88),
                height: this.translatePx(88)
            }],
            targetList: [{
                imageUrl: 'as231_png',
                y: this.translatePx(157),
                x: this.translatePx(40),
                name:'as1',
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'as231_png',
                y: this.translatePx(157),
                x: this.translatePx(143),
                name:'as2',
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'as231_png',
                y: this.translatePx(157),
                x: this.translatePx(246),
                name:'as3',
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'as231_png',
                y: this.translatePx(256),
                x: this.translatePx(40),
                name:'as4',
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'as231_png',
                y: this.translatePx(256),
                x: this.translatePx(143),
                name:'as5',
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'as231_png',
                y: this.translatePx(256),
                x: this.translatePx(246),
                name:'as6',
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'as231_png',
                y: this.translatePx(360),
                x: this.translatePx(40),
                name:'as7',
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'as231_png',
                y: this.translatePx(360),
                x: this.translatePx(143),
                name:'as8',
                width:this.translatePx(88),
                height: this.translatePx(88)
            },{
                imageUrl: 'as231_png',
                y: this.translatePx(360),
                x: this.translatePx(246),
                name:'as9',
                width:this.translatePx(88),
                height: this.translatePx(88)
            }],
            as2:false,
            as4:false,
            as5:false,
            as8:false,
            initLevel(){

            },
            registerEvent(item,$this) { 
                let that = this;
                item.addEventListener(egret.TouchEvent.TOUCH_TAP, (ev) => {
                    if(this.gameOver) return 
                    item.touchEnabled = false;
                    if(item.name === 'as2' || item.name === 'as4' || item.name === 'as5' || item.name === 'as8'){
                        that[item.name] = true
                        $this.SUCCESS_MUSIC.play(0,1)
                        item.texture = RES.getRes(`qs241_png`);
                        if(that.as2 && that.as4 && that.as5 && that.as8){
                            this.gameOver = true;
                            $this.showSuccessPage(that.type);
                        }
                    }else {
                        this.gameOver = true;
                        item.texture = RES.getRes(`qs232_png`);
                        $this.showFailPage();
                    }

                }, $this);
            }
        },{
            level: 25,
            type: 'memory',
            gameOver:false,
            duration1: 4000,
            duration2: 5000,
            title: '请你按顺序记住电话号码',
            title2: '请根据记忆点击选择'
        }
    ]

	public constructor() {
		super();
	}
	// 实例化单例获取方法
	public static getInstance(): LevelConfig{
		if(!LevelConfig.instance){
			LevelConfig.instance = new LevelConfig();
		}
		return LevelConfig.instance;
	}

    public getCurrentLevelConfig(level) {
        return this.LEVEL_CONFIG[level - 1];
    }

    public translatePx(num) {
        return Math.ceil(num * 1.7);
    }
}